$(document).ready(function () {
    var titleIds = localStorage.getItem("titleIds");
    var displayids = titleIds.split(",");
    console.log("displayids");
    console.log(displayids);
    // var displayids = [55,46,47,60];
    var html1 = '第一大题、单项选择题';
    var html2 = '第二大题、填空题';
    var html3 = '第三大题、判断题';
    var choNo = 1;
    var comNo = 1;
    var rolNo = 1;

    for (i = 0;i < displayids.length;i++) {
        console.log(displayids.length);
        $.get('/titleQuestion/displayPaper',{question_id:displayids[i]},function (data) {
            console.log("displayids:");
            console.log(displayids[i]);
            console.log(data);
            if (data.display[0].question_type == "单选题"){
                var question_option = JSON.parse(data.display[0].question_option);
                html1 += '<b><p><span>'+choNo+'、</span>'+data.display[0].question_subject+'</p></b><br>\n' +
                    '            &nbsp;&nbsp; &nbsp;&nbsp;<p>A：'+question_option.A+'</p> ' +
                    '            &nbsp;&nbsp; &nbsp;&nbsp;<p>B：'+question_option.B+'</p>' +
                    '            &nbsp;&nbsp; &nbsp;&nbsp;<p>C：'+question_option.C+'</p>' +
                    '            &nbsp;&nbsp; &nbsp;&nbsp;<p>D：'+question_option.D+'</p>' +
                    '<br>';
                choNo++;
            }else if (data.display[0].question_type == "填空题"){
                html2 += '<b><p><span>'+comNo+'、</span>'+data.display[0].question_subject+'</p></b><br/>\n' +
                    '            &nbsp;&nbsp; &nbsp;&nbsp;<input type="text" placeholder="请将答案填入文本框中">' +
                    '<br>';
                comNo++;
            }else if (data.display[0].question_type == "判断题"){
                var question_option = JSON.parse(data.display[0].question_option);
                html3 += '<b><p><span>'+rolNo+'、</span>'+data.display[0].question_subject+'</p></b><br/>\n' +
                    '            &nbsp;&nbsp;&nbsp;&nbsp;<span>T:'+question_option.T+'</span> &nbsp;&nbsp;&nbsp;&nbsp;<span>F:'+question_option.F+'错误</span>' +
                    '<br>';
                rolNo++;
            }
            $("#title1").html(html1);
            $("#title2").html(html2);
            $("#title3").html(html3);
        },'json');
    }

});